//
// Created by hunan on 25-7-20.
//

#include "data_util.h"

#include <sys/time.h>

uint64_t DateUtil::GetTimeOfSecond()
{
    return GetTimeOfMs() / 1000;
}

uint64_t DateUtil::GetTimeOfMs()
{
    struct timeval tm = {};
    gettimeofday(&tm, nullptr);
    return tm.tv_sec * 1000 + tm.tv_usec / 1000;
}

std::string DateUtil::GetTimeString()
{
    uint64_t time = GetTimeOfSecond();
    return std::to_string(time);
}
